package xyz.xmh.pattern.creational.abstractfactorypattern;

import xyz.xmh.pattern.creational.abstractfactorypattern.inter.Color;
import xyz.xmh.pattern.creational.abstractfactorypattern.inter.Shape;
import xyz.xmh.pattern.creational.abstractfactorypattern.inter.impl.Blue;
import xyz.xmh.pattern.creational.abstractfactorypattern.inter.impl.Green;
import xyz.xmh.pattern.creational.abstractfactorypattern.inter.impl.Red;

/**
 * ColorFactory
 *
 * @author xuMingHai
 * @since 2021/4/27 星期二 17:21
 */
public class ColorFactory extends AbstractFactory {

    /**
     * 红色
     */
    private static final String RED = "RED";

    /**
     * 绿色
     */
    private static final String GREEN = "GREEN";

    /**
     * 蓝色
     */
    private static final String BLUE = "BLUE";

    @Override
    public Color getColor(String colorType) {
        if (colorType == null) {
            return null;
        }
        if (colorType.equalsIgnoreCase(RED)) {
            return new Red();
        }
        else if (colorType.equalsIgnoreCase(GREEN)) {
            return new Green();
        }
        else if (colorType.equalsIgnoreCase(BLUE)) {
            return new Blue();
        }
        return null;
    }

    @Override
    public Shape getShape(String shapeType) {
        return null;
    }
}
